import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { CommonService } from 'src/app/service/common/common.service';
import { InformationService } from 'src/app/service/information.service';
import { XXGGInfos } from 'src/assets/mock/common/common';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

  constructor(
    private commonService: CommonService,
    private information: InformationService,
    private router: Router
  ) { }

  isHome: boolean = true
  ngOnInit(): void {
    this.getXXGGInfos()
    this.getPublicAnnouncement()
  }

  XXGGInfos: any = []
  getXXGGInfos(){
    this.information._getContentList('water_quality_notice', 1, 2).subscribe({
      next: res => {
        if(res && res.data){
          this.XXGGInfos = res.data
        }
      }
    })
  }

  // 获取公示公告
  publicAnnouncement: any = [] 
  getPublicAnnouncement(){
    this.information._getContentList('Public_announ', 1, 3).subscribe({
      next: res => {
        if(res && res.data){
          this.publicAnnouncement = res.data
        }
      }
    })
  }

  goDetail(item: any){
    this.router.navigate(['/information/detail'], { queryParams: { id: item.id } })
  }

  


  

}
